import {createApp} from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import axios from 'axios'
import Avue from '@smallwei/avue';
import '@smallwei/avue/lib/index.css';
import {createRouter, createWebHashHistory} from "vue-router";
import MainPage from "@/components/MainPage";
import StartPage from "@/components/StartPage";
import {createPinia} from 'pinia'
import CourseSettingForm from "@/components/CourseSettingForm";
import AppointPreviewView from "@/components/ArrangePreviewView";
import ArrangeExportView from "@/components/ArrangeExportView";

const pinia = createPinia();
// 2. 定义一些路由：每个路由都需要映射到一个组件。
const routes = [
    {
        path: '/', component: StartPage,
        meta: {
            keepAlive: true
        },
    },
    {
        path: '/main', component: MainPage,
        meta: {
            keepAlive: true
        },
    },
    {
        path: '/config', component: CourseSettingForm,
        meta: {
            keepAlive: true
        },
    },
    {
        path: '/preview', component: AppointPreviewView,
        meta: {
            keepAlive: true
        },
    }, {
        path: '/export', component: ArrangeExportView,
        meta: {
            keepAlive: true
        },
    }

]

// 3. 创建路由实例并传递 `routes` 配置。
const router = createRouter({
    // 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
    history: createWebHashHistory(),
    routes, // `routes: routes` 的缩写
})

const app = createApp(App)
app.use(pinia)
    .use(router)
    .use(Avue, {
        axios,
        text: 'avuejs.com',
        fontFamily: 'microsoft yahei',
        color: "#999",
        fontSize: 16,
        opacity: 100,
        bottom: 10,
        right: 10,
        ratio: 1
    })
    .use(ElementPlus)
app.mount('#app');